package com.lan.seriousphysics.screens;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Scaling;
import com.lan.seriousphysics.SeriousPhysicsMain;
import com.lan.seriousphysics.screens.experimentMenus.MCUScreen;
import com.lan.seriousphysics.screens.experimentMenus.MRUAScreen;
import com.lan.seriousphysics.screens.experimentMenus.MRUScreen;
import com.lan.seriousphysics.screens.experimentMenus.OndasScreen;

public class ExperimentosScreen extends AbstractScreen {

	public ExperimentosScreen(SeriousPhysicsMain game) {
		super(game);
		// TODO Auto-generated constructor stub
	}

	
    @Override
    public void show()
    {
        super.show();
        
     	previousScreen = new MenuScreen(game);
        
        setBackground("experimentos.png");
        
       
        // Obtenemos la tabla
        Table table = super.getTable();

       // le damos cierto formato a la pantalla
        formateoPrevioPantalla(table);
        
        //cramos los botones
        crearBotonMRU(table);
     
        crearBotonMRUA(table);
     
        crearBotonOndas(table);
        
        
        crearBotonMCU(table);
             
           
    }


	private void formateoPrevioPantalla(Table table) {
		Label titulo = new Label(" ", getSkin());

        table.add(titulo);
        
        table.left().top();
        
        table.defaults().expandX().pad(10).space(10);
        
        table.row();
	}


	private void crearBotonOndas(Table table) {
		TextButton botonONDAS = new TextButton( res.getString("ONDAS_BOT"), getSkin() );
        table.add( botonONDAS ).size(100,100).uniform();
        botonONDAS.addListener(new InputListener() {
            public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
               //super.touchUp(event, x, y, pointer, button);
            	
            	game.setScreen(new OndasScreen(game,"ONDAS"));
            	return true;
        }
        
});
	}


	private void crearBotonMRUA(Table table) {
		TextButton botonMRUA = new TextButton( res.getString("MRUA_BOT"), getSkin() );
        table.add( botonMRUA ).size(100,100).uniform();
        botonMRUA.addListener(new InputListener() {
            public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
               //super.touchUp(event, x, y, pointer, button);
            	
            	game.setScreen(new MRUAScreen(game,"MRUA"));
            	return true;
        }
        
});
	}


	private void crearBotonMRU(Table table) {
		TextButton botonMRU = new TextButton( res.getString("MRU_BOT"), getSkin() );
        table.add( botonMRU ).size(100,100).uniform();
        botonMRU.addListener(new InputListener() {
            public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
               //super.touchUp(event, x, y, pointer, button);
            	
            	game.setScreen(new MRUScreen(game,"MRU"));
            	return true;
        }
        
});
	}
	
	private void crearBotonMCU(Table table) {
		TextButton botonMCU = new TextButton( res.getString("MCU_BOT"), getSkin() );
        table.add( botonMCU ).size(100,100).uniform();
        botonMCU.addListener(new InputListener() {
            public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
               //super.touchUp(event, x, y, pointer, button);
            	
            	game.setScreen(new MCUScreen(game,"MCU"));
            	return true;
        }
        
});
	}
}
